<template>
  <div class="ele-body ele-body-card">
    <el-row  :gutter="15">
      <el-col  :lg="8" :md="8"> 
        <el-card shadow="never" class="monitor-count-card" header="声音合成次数">
          <el-row :gutter="15">
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-today.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">今日</span>
                  <span class="sp2"><span class="sp3">{{indexData.soundCountToday}}</span> 次</span>
                </div>
              </div>
            </el-col>
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-yesterday.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">昨日</span>
                  <span class="sp2"><span class="sp3">{{indexData.soundCountYesterday}}</span> 次</span>
                </div>
              </div>
            </el-col>
            
          </el-row>
        </el-card>
      </el-col>
      <el-col  :lg="8" :md="8"> 
        <el-card shadow="never" class="monitor-count-card" header="声音合成时长">
          <el-row :gutter="15">
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-today.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">今日</span>
                  <span class="sp2"><span class="sp3">{{indexData.soundSecondToday}}</span> 分</span>
                </div>
              </div>
            </el-col>
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-yesterday.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">昨日</span>
                  <span class="sp2"><span class="sp3">{{indexData.soundSecondYesterday}}</span> 分</span>
                </div>
              </div>
            </el-col>
            
          </el-row>
        </el-card>
      </el-col>
      <el-col  :lg="8" :md="8"> 
        <el-card shadow="never" class="monitor-count-card" header="声音克隆次数">
          <el-row :gutter="15">
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-today.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">今日</span>
                  <span class="sp2"><span class="sp3">{{indexData.voiceCountToday}}</span> 次</span>
                </div>
              </div>
            </el-col>
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-yesterday.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">昨日</span>
                  <span class="sp2"><span class="sp3">{{indexData.voiceCountYesterday}}</span> 次</span>
                </div>
              </div>
            </el-col>
            
          </el-row>
        </el-card>
      </el-col>
    </el-row>
    <el-row  :gutter="15"> 
      <el-col  :lg="8" :md="8">
        <el-card shadow="never" class="monitor-count-card" header="视频合成次数">
          <el-row :gutter="15">
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-today.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">今日</span>
                  <span class="sp2"><span class="sp3">{{indexData.videoCountToday}}</span> 次</span>
                </div>
              </div>
            </el-col>
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-yesterday.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">昨日</span>
                  <span class="sp2"><span class="sp3">{{indexData.videoCountYesterday}}</span> 次</span>
                </div>
              </div>
            </el-col>
            
          </el-row>
        </el-card>
      </el-col>
      <el-col  :lg="8" :md="8">
        <el-card shadow="never" class="monitor-count-card" header="视频合成时长">
          <el-row :gutter="15">
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-today.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">今日</span>
                  <span class="sp2"><span class="sp3">{{indexData.videoSecondToday}}</span> 分</span>
                </div>
              </div>
            </el-col>
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-yesterday.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">昨日</span>
                  <span class="sp2"><span class="sp3">{{indexData.videoSecondYesterday}}</span> 分</span>
                </div>
              </div>
            </el-col>
            
          </el-row>
        </el-card>
      </el-col>
      <el-col  :lg="8" :md="8">
        <el-card shadow="never" class="monitor-count-card" header="形象克隆次数">
          <el-row :gutter="15">
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-today.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">今日</span>
                  <span class="sp2"><span class="sp3">{{indexData.avatarCountToday}}</span> 次</span>
                </div>
              </div>
            </el-col>
            <el-col :lg="12" :md="12">
              <div class="card_box">
                <div class="card_box_cir">
                  <img class="card_icon" src="@/assets/icon/icon-yesterday.png" alt="">
                </div>
                <div class="card_box_txt">
                  <span class="sp1">昨日</span>
                  <span class="sp2"><span class="sp3">{{indexData.avatarCountYesterday}}</span> 次</span>
                </div>
              </div>
            </el-col>
            
          </el-row>
        </el-card>
      </el-col>
     
    </el-row>
   
    
  </div>
</template>

<script>
  import VueCountUp from 'vue-countup-v2';
  import { getIndexData} from '@/api/statis';
  export default {
    name: 'IndexData',
    props: {
      account_id: {
        type: Number,
        default: 0
      },
    },
    components: { VueCountUp },
    data() {
      return {
        countUpOptions: {
          useEasing: true,
          useGrouping: true,
          decimalPlaces:2,
          separator: ',',
          decimal: '.',
          prefix: '',
          suffix: ''
        },
        indexData:{
          
          'soundCountToday':0,
          'soundSecondToday':0,
          'voiceCountToday':0,
          'avatarCountToday':0,
          'videoCountToday' :0,
          'videoSecondToday' :0,
          
          'soundCountYesterday':0,
          'soundSecondYesterday':0,
          'voiceCountYesterday':0,
          'avatarCountYesterday':0,
          'videoCountYesterday' :0,
          'videoSecondYesterday' :0,
          
        },
      };
    },
    created() {
      this.getShowData();
    },
    methods: {
      getShowData(){
        getIndexData({account_id:this.account_id}).then((data) => {
          if(data != null){
            this.indexData = data;
          }
        }).catch((e) => {
          this.$message.error(e.message);
        })
      }
    },
    watch: {
      account_id(){
        this.getShowData();
      }
    },
  };
</script>

<style scoped>
.title {
    padding-left: 10px;
    border-left: 3px solid #0256ff;
    font-size: 15px;
    color: #303133;
  }
  .card_box_cir1 .iconfont {
      font-size: 26px;
      color: #fff;
  }
  .card_icon{
    width: 52px;
    height: 52px;
  }

  .card_box {
      width: 100%;
      height: 100%;
      display: flex;
      -webkit-box-align: center;
      align-items: center;
      box-sizing: border-box;
      border-radius: 4px;
  }
  .card_box .card_box_cir {
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
  }



   .card_box .card_box_cir {
    
    border-radius: 50%;
    display: flex;
    -webkit-box-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    align-items: center;
  }

  
  .card_box .card_box_cir {
    width: 45px;
    height: 45px;
    overflow: hidden;
    margin-right: 20px;
  }

  .card_box .card_box_txt .sp1 {
    display: block;
    color: #252631;
    font-size: 14px;
    margin-bottom: 5px;
  }

  .card_box .card_box_txt .sp2 {
    display: block;
    color: #98a9bc;
    font-size: 16px;
  }

  .card_box .card_box_txt .sp3 {
    color:#1890FF;
    font-size: 20px;
  }
  .monitor-count-card ::v-deep .el-card__body {
    padding-top: 18px;
    text-align: center;
    position: relative;
  }

  .monitor-count-card ::v-deep .el-tag {
    border-color: transparent;
    font-size: 15px;
  }

  .monitor-count-card .monitor-count-card-num {
    font-weight: 500;
    font-size: 32px;
    margin-top: 12px;
  }

  .monitor-count-card .monitor-count-card-text {
    font-size: 12px;
    margin: 10px 0;
  }

  .monitor-count-card .monitor-count-card-trend {
    font-weight: 600;
    padding: 6px 0;
  }

  .monitor-count-card .monitor-count-card-trend > i {
    font-size: 12px;
    font-weight: 600;
    margin-right: 5px;
  }

  .monitor-count-card .monitor-count-card-tips {
    position: absolute;
    top: 15px;
    right: 15px;
    cursor: pointer;
  }
</style>
